<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 父类型
        function Super() {
            this.supProp = 'Super Proterty'
        }
        Super.prototype.showSuperProterty = function () {
            console.log(this.supProp)
        }

        function Sub () {
            this.subProp = 'Sub Property'
        }
        Sub.prototype = new Super()  // 把Sub的原型对象改为Super的实例

        Sub.prototype.showSubProperty = function() {  // 实际添加到了Super实例里面
            console.log(this.subProp)
        }

        const sub = new Sub()  // sub的__proto__指向的是Super的实例
        sub.showSubProperty()
        sub.showSuperProterty()
    </script>
</body>
</html>